<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <div th:include="header :: header"></div>
    <title>兼职发布</title>
    <script th:src="@{/static/js/modules/job/job.js}"></script>
<!--    <script th:src="@{/static/plugins/layui/js/tableSelect.js}"></script>-->
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div th:include="body :: body"></div>
    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">
<!--            这好像是个搜索栏-->
            <div class="demoTable">
                <label> 兼职名称：</label>
                <div class="layui-inline">
                    <input class="layui-input" id="demoReload" autocomplete="off">
                </div>
                <button class="layui-btn" data-type="reload">搜索</button>
            </div>
            <table class="layui-hide" id="tableData" lay-filter="tableData"></table>

            <script type="text/html" id="toolbarDemo">
                <div class="layui-btn-container">
                    <button class="layui-btn" lay-event="add">
                        <i class="layui-icon">&#xe608;</i> 添加
                    </button>
                </div>
            </script>
            <script type="text/html" id="bar">
                <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
                <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
                <a class="layui-btn layui-btn-xs" lay-event="query">查看</a>
            </script>

        </div>
    </div>

    <div th:include="footer :: footer"></div>
</div>

<div>
    <div class="layui-layout layui-layout-body" id="testDiv" lay-filter="testDiv">
        <div id="queryDiv" style="display: none; margin-top: 10px">
            <table class="layui-hide" id="stuInfo" lay-filter="stuInfo"></table>
            <!--    <div style="padding: 15px;">-->
            <!--        -->
            <!--    </div>-->
            <script type="text/html" id="toolbarInfo">
                <div class="layui-btn-container">
                </div>
            </script>
        </div>
    </div>
</div>

<div id="formDiv"  style="display:none; margin-top: 10px">
    <!--form表单-->
    <form  class="layui-form" lay-filter="form">
        <input type="text" id="jobId" name="jobId"  style="display:none;">
        <div class="layui-form-item">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-inline">
                <input type="text" name="title" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">描述</label>
            <div class="layui-input-inline">
                <input type="text" name="describe" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">工资</label>
            <div class="layui-input-inline">
                <input type="text" name="wage" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">地址</label>
            <div class="layui-input-inline">
                <input type="text" name="address" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">内容</label>
            <div class="layui-input-inline">
                <input type="text" name="content" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
<!--        <div class="layui-form-item">-->
<!--            <label class="layui-form-label">发布人id</label>-->
<!--            <div class="layui-input-inline">-->
<!--                <input type="text" name="sysUserId" lay-verify="required" autocomplete="off" class="layui-input">-->
<!--            </div>-->
<!--        </div>-->
<!--        <div class="layui-form-item">-->
<!--            <label class="layui-form-label">发布人name</label>-->
<!--            <div class="layui-input-inline">-->
<!--                <input type="text" name="sysUserName" lay-verify="required" autocomplete="off" class="layui-input">-->
<!--            </div>-->
<!--        </div>-->
        <div class="layui-form-item">
            <label class="layui-form-label">可参加人数</label>
            <div class="layui-input-inline">
                <input type="text" name="total" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
<!--        <div class="layui-form-item">-->
<!--            <label class="layui-form-label">当前人数</label>-->
<!--            <div class="layui-input-inline">-->
<!--                <input type="text" name="totalNow" lay-verify="required" autocomplete="off" class="layui-input">-->
<!--            </div>-->
<!--        </div>-->
        <div class="layui-form-item">
            <label class="layui-form-label">起始时间</label>
            <div class="layui-input-inline">
                <input type="date" name="activitiesTime" lay-verify="required" autocomplete="off" class="layui-laydate">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">结束日期</label>
            <div class="layui-input-inline">
                <input type="date" name="endTime" lay-verify="required" autocomplete="off" class="layui-laydate">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <select name="state" lay-verify="required">
                    <option value=""></option>
                    <option value="0">删除</option>
                    <option value="1">正常</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">热度</label>
            <div class="layui-input-block">
                <select name="isHost" lay-verify="required">
                    <option value="0">否</option>
                    <option value="1">是</option>
                </select>
            </div>
        </div>
<!--        <div class="layui-form-item">-->
<!--            <label class="layui-form-label">查看报名人员</label>-->
<!--            <div class="layui-input-block">-->
<!--                -->
<!--            </div>-->
<!--        </div>-->
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formButton">立即提交</button>
            </div>
        </div>
    </form>
</div>
<!--<script type="text/html" id="switchTpl">-->
<!--    <input type="checkbox" name="sex" value="{{d.userId}}" lay-skin="switch" lay-text="正常|禁用" lay-filter="stateChech" {{d.state == 1 ? 'checked' : ''}}>-->
<!--</script>-->
<script type="text/html" id="switchIsHost">
    <input type="checkbox" name="isHost" value="{{d.jobId}}" lay-skin="switch" lay-text="是|否" lay-filter="isHostCheck" {{d.isHost == 1 ? 'checked' : ''}}>
</script>
<script type="text/html" id="switchState">
    <input type="checkbox" name="state" value="{{d.jobId}}" lay-skin="switch" lay-text="正常|已删除" lay-filter="stateCheck" {{d.state == 1 ? 'checked' : ''}}>
</script>
<script>
    layui.use(['form'], function(){
        var form = layui.form;
        form.render();
        //监听提交
        form.on('submit(formButton)', function(data){
            var url="/job/save";       //好像是提交到指定的控制器
            if($('#jobId').val()!=""){
                url="/job/update";
            }
            $.ajax({
                url:url,
                type:"post",
                contentType: "application/json",
                data:JSON.stringify(data.field),
                success:function (r) {
                    if (r.code == 0) {
                        layer.msg(r.msg, {
                            icon: 1,
                            shade: 0.3,
                            time: 2000
                        }, function () {
                            //疯狂模式，关闭所有层
                            reloadTable();
                            parent.layer.closeAll();

                        });
                    }else{
                        layer.msg(r.msg, {
                            icon: 2,
                            shade: 0.3,
                            time: 1000
                        });
                    }
                }
            })
            return false;
        });
    });
</script>
</body>


</html>